package initialize

import (
	"fmt"
	"github.com/cy77cc/hioshop/global"
	"github.com/cy77cc/hioshop/models"
)

func Migrate() {
	fmt.Println("migrate start")
	fmt.Println(global.DB.Migrator().CurrentDatabase())
	defer func() {
		if err := recover(); err != nil {
			fmt.Println(err)
		}
	}()
	_ = global.DB.AutoMigrate(
		&models.Ad{},
		&models.Address{},
		&models.Admin{},
		&models.Cart{},
		&models.Category{},
		&models.ExceptArea{},
		&models.ExceptAreaDetail{},
		&models.Footprint{},
		&models.Formid{},
		&models.FreightTemplate{},
		&models.FreightTemplateDetail{},
		&models.FreightTemplateGroup{},
		&models.Goods{},
		&models.GoodsGallery{},
		&models.GoodsSpecification{},
		&models.Keywords{},
		&models.Notice{},
		&models.Order{},
		&models.OrderExpress{},
		&models.OrderGoods{},
		&models.Product{},
		&models.Region{},
		&models.SearchHistory{},
		&models.Settings{},
		&models.Shipper{},
		&models.ShowSetting{},
		&models.Specification{},
		&models.User{},
	)
}
